home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacMETH 3.2.1 / MacMETH Manual 1992 / Manual Examples / TextExample.MOD < prev    next >
Encoding:
Text File  |  1992-10-09  |  1012 b   |  41 lines  |  [TEXT/MEDT]

  1. MODULE TextExample; (* demonatrates the use of text windows*)
  2.  
  3.     FROM TextWindows IMPORT    Window,OpenTextWindow, CloseTextWindow, WriteLn,
  4.                             WriteString, WriteInt, Write, IdentifyPos;
  5.     FROM CursorMouse IMPORT    GetMouse, ML, MM;
  6.   
  7.       VAR     Buttons     : BITSET;
  8.           x,y,col,
  9.           line        : INTEGER;
  10.           w           : Window;
  11.       
  12. BEGIN
  13.     OpenTextWindow(w,5,5,502,315,"TextWindow-Demo");
  14.     WriteString(w,"Press the mouse button!");
  15.     WriteLn(w);
  16.     WriteLn(w);
  17.     LOOP
  18.         GetMouse(Buttons,x,y);
  19.         IF (MM IN Buttons) & (ML IN Buttons) THEN
  20.             EXIT
  21.          ELSIF (ML IN Buttons) THEN
  22.             IdentifyPos(w,x,y,line,col);
  23.             WriteString(w,"You pressed the mouse button at position (");
  24.             WriteInt(w,x,3);
  25.             Write(w,",");
  26.             WriteInt(w,y,3);
  27.             WriteString(w,") on the screen,");
  28.             WriteLn(w);
  29.             WriteString(w,"i.e. in line ");
  30.             WriteInt(w,line,2);
  31.             WriteString(w," and column ");
  32.             WriteInt(w,col,2);
  33.             Write(w,".");
  34.             WriteLn(w);
  35.             WriteLn(w);
  36.         END (* IF *)
  37.     END (* LOOP *);
  38.     CloseTextWindow(w);
  39. END TextExample.
  40.  
  41.